/**
 * Heterotopia - an up-to-date Java-based MUD system
 * Copyright (C) 2011 Bill Garrett <memesis@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package heterotopia.oa;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * @author garrett
 */
@Entity
@Table(name = "DURABLE_OBJECTS")
public class DurableObject {
	@Id
	@GeneratedValue(generator="system-uuid")
	@GenericGenerator(name="system-uuid", strategy = "uuid")
	private String id;
	
	private String language;
	
	private String codebehind;

	@Lob
	private byte[] storage;
	
	public DurableObject() {
	}
	
	/**
	 * Returns the unique ID for this object (a UUID) as a string.
	 * 
	 * @return a string representation of this object's unique identity.
	 */
	public String getId() {
		return id;
	}
	
	/**
	 * Gets the language used to implement codebehind for this object (e.g. "jruby")
	 * 
	 * @return the language
	 */
	public String getLanguage() {
		return language;
	}

	/**
	 * Sets the language used to implement codebehind for this object (e.g. "jruby")
	 * 
	 * @param language the language to set
	 */
	public void setLanguage(String language) {
		this.language = language;
	}

	/**
	 * Gets the scripting code used to implement this object (e.g. "2+2")
	 * 
	 * @return the codebehind
	 */
	public String getCodebehind() {
		return codebehind;
	}

	/**
	 * Sets the scripting code used to implement this object (e.g. "2+2")
	 * 
	 * @param codebehind the codebehind to set
	 */
	public void setCodebehind(String codebehind) {
		this.codebehind = codebehind;
	}

	/**
	 * 
	 * @return
	 */
	public byte[] getStorage() {
		return storage;		
	}
	
	/**
	 * 
	 * @param value
	 */
	public void setStorage(byte[] value) {
		this.storage = value;
	}
}